<!DOCTYPE HTML>
<html>
<style>
    .xkMain{width:1500px; margin:40px auto;}
    .sqlTable{border:1px solid #dedede; margin-top:30px}
    .sqlTable td{border:1px solid #dedede;}
    .xCenter{
        text-align: center;
    }
    .td_1000{
        width:1000px;
        overflow-wrap: break-word;
    }
    .grbg{background: #dedede;}
    .xcp{padding:3px 3px;background: #6666; color:#FFFFFF;}
</style>
<script src="./static/js/jquery.js"></script>
<?php
 $r = "\r\n\r\n";
?>
<div class="xkMain">
    <div>
        用户名：{$userRealName}<br/>
        店铺名：{$shopName}
    </div>
    <table class="sqlTable">
        <tr>
            <td colspan="2" class="grbg xCenter">
                花费相关sql
            </td>
        </tr>
        <tr>
            <td style="width:300px;">获取店铺sql:</td>
            <td class="td_1000"><div class="td_1000"><span class="xcp" data-id="a1">copy</span><textarea id="a1" style="width: 100%;">{$shopSql??''}</textarea></div></td>
        </tr>
        <tr>
            <td>获取用户sql:</td>
            <td class="td_1000"><div class="td_1000"><span class="xcp" data-id="a2">copy</span><textarea id="a2" style="width: 100%;">{$userSql??''}</textarea></div></td>
        </tr>
        <tr>
            <td>用户id:{$baseInfo['user_id']??''}</td>
            <td class="td_1000"><div class="td_1000">店铺id:{$baseInfo['shop_id']??''}</div></td>
        </tr>
        <tr>
            <td>获取花费sql:</td>
            <td class="td_1000"><span class="xcp" data-id="a3">copy</span><textarea id="a3" style="width: 100%;">{$constSql??''}</textarea></td>
        </tr>
        <tr>
            <td colspan="2" class="grbg xCenter">
                销售额相关sql
            </td>
        </tr>
        <tr>
            <td style="width:300px;">开票详情(上下月)sql:</td>
            <td >
                <div class="td_1000"><span class="xcp" data-id="a4">copy</span>
                    <textarea id="a4" style="width: 100%;">{$invoicesDeatilSql??''}{$r}{$invoicesNextDeatilSql??''}</textarea>
                </div>
            </td>
        </tr>

        <tr>
            <td style="width:300px;">花费(上下月)sql:</td>
            <td ><div class="td_1000"><span class="xcp" data-id="a6">copy</span><textarea id="a6" style="width: 100%;">{$salesSql??''}{$r}{$nextSalesSql??''}</textarea></div></td>
        </tr>
    </table>

    <table class="sqlTable">
        <tr>
            <td colspan="2" class="grbg xCenter">
                花费(店铺：<span style="color:#FF0000;">{$shopName}</span>,用户：<span style="color:#FF0000;">{$userRealName}</span>)
            </td>
        </tr>
        <tr>
            <td style="width:300px;">
                【总】开票日期为当月的花费:{$total_amount??''}<br/>
                {foreach $type as $t}
                【{$t}】开票日期为当月的花费:{$current_diff_const[$t]??0}<br/>
                {/foreach}
            </td>
            <td style="width:1000px;"></td>
        </tr>
        <tr>
            <td style="width:300px;">
                 【总】跨上月的花费:{$before_month_amount??''}<br/>
                {foreach $type as $t}
                【{$t}】开票日期为当月的花费:{$before_current_diff_const[$t]??0}<br/>
                {/foreach}
            </td>
            <td style="width:1000px;">
                {if $before_month_amount > 0}
                    <table style="width:100%;">
                        <tr>
                            {foreach $constColumn as $value}
                            <td class="grbg">{$value}</td>
                            {/foreach}
                        </tr>
                        {foreach $beforeList as $value}
                            <tr>
                                {foreach $value as $val}
                                <td>{$val}</td>
                                {/foreach}
                            </tr>
                        {/foreach}

                    </table>
                {/if}

            </td>
        </tr>
        <tr>
            <td style="width:300px;">
                【总】跨下月的花费:{$next_month_amount??''}<br/>
                {foreach $type as $t}
                【{$t}】开票日期为当月的花费:{$next_current_diff_const[$t]??0}<br/>
                {/foreach}
            </td>
            <td style="width:1000px;">
                {if $before_month_amount > 0}
                <table style="width:100%;">
                    <tr>
                        {foreach $constColumn as $value}
                        <td class="grbg">{$value}</td>
                        {/foreach}
                    </tr>
                    {foreach $nextList as $value}
                    <tr>
                        {foreach $value as $val}
                        <td>{$val}</td>
                        {/foreach}
                    </tr>
                    {/foreach}

                </table>
                {/if}

            </td>
        </tr>
        <tr>
            <td style="width:300px;">正常花费区间范围</td>
            <td>
                【总】{$constBetween??''}<br>
                {foreach $betweenDiff as $key=>$v}
                【{$key}】:{$v}<br/>
                {/foreach}
            </td>
        </tr>

    </table>

    <table class="sqlTable">
        <tr>
            <td colspan="2" class="grbg xCenter">
                销售额
            </td>
        </tr>
        <tr>
            <td style="width:300px;">当月销售额:{$sales_amount??''}</td>
            <td style="width:1000px;">跨月下月销售额:{$next_sales_amount??''}</td>
        </tr>
        <tr>
            <td style="width:300px;">当月SP:{$current_sales_amount_diff['SP']['sales_amount']??''}</td>
            <td style="width:1000px;">下月SP:{$next_sales_amount_diff['SP']['sales_amount']??''}</td>
        </tr>
        <tr>
            <td style="width:300px;">当月SB:{$current_sales_amount_diff['SB']['sales_amount']??''}</td>
            <td style="width:1000px;">下月SB:{$next_sales_amount_diff['SB']['sales_amount']??''}</td>
        </tr>
        <tr>
            <td style="width:300px;">当月SD:{$current_sales_amount_diff['SD']['sales_amount']??''}</td>
            <td style="width:1000px;">下月SD:{$next_sales_amount_diff['SD']['sales_amount']??''}</td>
        </tr>

    </table>
    <table class="sqlTable">
        <tr>
            <td colspan="2" class="grbg xCenter">
                当月销售额细分
            </td>
        </tr>
        {foreach $current_sales_amount_diff??[] as $key=>$value}
        <tr>
            <td style="width:300px;">当月{$key}:{$value['sales_amount']??0}</td>
            <td style="width:1000px;">
                <table style="width:100%;">
                    <tr><td>campaign_id</td><td>销售额</td></tr>
                    {foreach $value.list as $val}
                    <tr><td>{$val['campaignid']??''}</td><td>{$val['sales14d']??''}</td></tr>
                    {/foreach}
                </table>
            </td>
        </tr>
        {/foreach}

    </table>
    <table class="sqlTable">
        <tr>
            <td colspan="2" class="grbg xCenter">
                跨月下月销售额细分
            </td>
        </tr>
        {foreach $next_sales_amount_diff??[] as $key=>$value}
        <tr>
            <td style="width:300px;">下月{$key}:{$value['sales_amount']??0}</td>
            <td style="width:1000px;">
                <table style="width:100%;">
                    <tr><td>campaign_id</td><td>销售额</td></tr>
                    {foreach $value.list as $val}
                    <tr><td>{$val['campaignid']??''}</td><td>{$val['sales14d']??''}</td></tr>
                    {/foreach}
                </table>
            </td>
        </tr>
        {/foreach}

    </table>
</div>
<script>
    $(".xcp").click(function (){
        var id = $(this).data('id');
        var Url = document.getElementById(id);
        Url.select();
        document.execCommand("Copy");
    });
</script>
</html>